aux_source_directory(lib SRC_CORE_LIB_TEST)
add_executable(xdl_core_lib_test ${SRC_CORE_LIB_TEST})
target_link_libraries(xdl_core_lib_test gtest gtest_main ${XDL_CORE_LIB})
add_test(NAME xdl_core_lib_test COMMAND xdl_core_lib_test)

aux_source_directory(grappler SRC_CORE_FRAMEWORK_TEST)
aux_source_directory(framework SRC_CORE_FRAMEWORK_TEST)
add_executable(xdl_core_framework_test ${SRC_CORE_FRAMEWORK_TEST})
target_link_libraries(xdl_core_framework_test gtest gtest_main ${XDL_CORE_LIB})
add_test(NAME xdl_core_framework_test COMMAND xdl_core_framework_test)

aux_source_directory(model_server SRC_MODEL_SERVER_TEST)
add_executable(xdl_core_model_server_test ${SRC_MODEL_SERVER_TEST})
target_link_libraries(xdl_core_model_server_test gtest gtest_main ${XDL_CORE_LIB})
add_test(NAME xdl_core_model_server_test COMMAND xdl_core_model_server_test)

aux_source_directory(utils SRC_CORE_UTILS_TEST)
add_executable(xdl_core_utils_test ${SRC_CORE_UTILS_TEST})
target_link_libraries(xdl_core_utils_test gtest gtest_main ${XDL_CORE_LIB})
add_test(NAME xdl_core_utils_test COMMAND xdl_core_utils_test)

aux_source_directory(backend/tf SRC_CORE_BACKEND_TF_TEST)
aux_source_directory(backend/mxnet SRC_CORE_BACKEND_MX_TEST)
set(SRC_BACKEND_TEST "")
IF (TF_BACKEND)
   list(APPEND SRC_BACKEND_TEST ${SRC_CORE_BACKEND_TF_TEST})
ENDIF()
IF (MXNET_BACKEND)
   list(APPEND SRC_BACKEND_TEST ${SRC_CORE_BACKEND_MX_TEST})
ENDIF()

IF (TF_BACKEND OR MXNET_BACKEND)
   add_executable(xdl_core_backend_test ${SRC_BACKEND_TEST})
   target_link_libraries(xdl_core_backend_test gtest gtest_main ${XDL_CORE_LIB})
   add_test(NAME xdl_core_backend_test COMMAND xdl_core_backend_test)
ENDIF()
